package leetcode;

/**
 * @author zhangjunfei
 * @date 2023/8/30 17:14
 */
public class L_974 {
    public int subarraysDivByK(int[] nums, int k) {
        int result = 0;
        for (int i = 0; i < nums.length; i++) {
            int count = nums[i];
            if (count % k == 0) {
                result++;
            }
            for (int j = i+1; j < nums.length; j++) {
                count += nums[j];
                if (count % k == 0) {
                    result++;
                }
            }
        }
        return result;
    }
}
